package com.i2works.smartluolong.manage.dal.admin.dao;


import com.i2works.smartluolong.manage.entity.admin.AdminRoleDO;
import com.i2works.smartluolong.manage.entity.admin.AdminRoleQuery;
import com.i2works.smartluolong.manage.entity.admin.AdminRoleResDO;
import com.i2works.smartluolong.manage.entity.admin.AdminRoleResQuery;
import com.i2works.smartluolong.utils.basecommon.BaseCommonDAO;
import com.i2works.smartluolong.utils.exception.DAOException;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Set;

/**
 * 管理员角色DAO接口
 *
 * @author koal koal@vip.qq.com
 * @date 2015年11月3日 下午11:22:04
 */

@Mapper
@Repository("adminRoleDAO")
public interface IAdminRoleDAO extends BaseCommonDAO<AdminRoleQuery, AdminRoleDO> {

    /**
     * 查询某用户的角色列表
     */
    Set<AdminRoleDO> queryUserRoleList(AdminRoleQuery query) throws DAOException;

    /**
     * 查询某用户的角色
     *
     * @see 存在多个就只去第一个，用于工作流中用户的角色获取
     */
    AdminRoleDO queryUserRole(AdminRoleQuery query) throws DAOException;

    /**
     * 查询角色资源关系表
     */
    List<AdminRoleResDO> queryRoleResList(AdminRoleResQuery query) throws DAOException;

    /**
     * 添加角色资源关系表
     */
    void saveRoleRes(AdminRoleResDO adminRoleResDO) throws DAOException;


    /**
     * 更新角色资源关系表状态
     */
    void updateRoleResStatus(AdminRoleResDO adminRoleResDO) throws DAOException;

    /**
     * 删除角色资源关系表
     */
    void deleteRoleRes(Integer roleId) throws DAOException;

    /**
     * 批量删除关联表
     */
    void deleteBatchRoleRes(List<Integer> idsList) throws DAOException;
}
